package initialize

import (
	"common/global"
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
)

func InitEs() {
	cf := Config.Es
	cfg := elasticsearch.Config{
		Addresses: []string{
			cf.Addr,
		},
	}
	var err error
	global.Es, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println("init es success")
}
